# -*- coding:utf-8 -*-

## =====================================================================
## Copyright (C) 2007-2011  Jean-Philippe GOLAY
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
## =====================================================================


from Tkinter import *
from tkMessageBox import *
from Persistance import *

class AreaGUI(Toplevel):
	def __init__(self, parent=None, balloon=None, path=None, log=None):
		Toplevel.__init__(self, parent)
		self.parent=parent
		self.grab_set()
		self.transient(self.master)
		self.resizable(width=False, height=False)
		self.title(u"Pays, Régions, Départements, CP, Villes")
		self.path=path
		self.log=log
		self.balloon=balloon
		self.imgSave=PhotoImage(file="img/save_icon.gif")
		self.imgDelete=PhotoImage(file="img/delete_icon.gif")
		self.imgClear=PhotoImage(file="img/clear_icon.gif")
		# Afficher un icon personnalisé
		try:
			if os.name =="posix":
				img = PhotoImage(file=self.path+"/icons/Area-icon.gif")
				self.tk.call("wm", "iconphoto", self._w, img)
			else:
				self.iconbitmap(default=self.path+"/icons/Area-icon.gif")
		except TclError:
			self.log.warning("Le window manager ne supporte pas l'icône que je veux lui mettre...")
		self.log.info(u"\tAreaGUI\tStart")
		self.makeArea()

	# DEBUT de la gestion du module Area (contient Country, State, County, ZipCode, City) ---------------------------------------
	def fieldCountry(self, event=None):
		result = Country.select(Country.q.id==self.idListCountry[int(self.listCountry.curselection()[0])])
		for row in result:
			self.selectedCountry = row
			self.countryValues[0].set(self.selectedCountry.code)
			self.countryValues[1].set(self.selectedCountry.name)
		self.saveCountryBt.config(state=NORMAL)
		self.deleteCountryBt.config(state=NORMAL)
		self.deleteStateBt.config(state=DISABLED)
		self.saveStateBt.config(state=NORMAL)
		self.saveCountyBt.config(state=DISABLED)
		self.deleteCountyBt.config(state=DISABLED)
		self.deleteZipCodeBt.config(state=DISABLED)
		self.saveZipCodeBt.config(state=DISABLED)
		self.deleteCityBt.config(state=DISABLED)
		self.saveCityBt.config(state=DISABLED)
		self.listZipCode.delete(0,END)
		self.listCity.delete(0,END)
		self.listCounty.delete(0,END)
		self.searchCountyValue.set("")
		self.searchZipCodeValue.set("")
		self.searchCityValue.set("")
		self.stateValues[0].set("")
		self.stateValues[1].set("")
		self.selectedState =  None
		self.countyValues[0].set("")
		self.countyValues[1].set("")
		self.selectedCounty =  None
		self.zipCodeValues.set("")
		self.selectedZipCode =  None
		self.cityValues[0].set("")
		self.cityValues[1].set("")
		self.selectedCity =  None
		self.listState.delete(0,END)
		self.idListState = []
		self.searchStateValue.set("")
		result = State.select(State.q.country==self.selectedCountry)
		for row in result:
			self.listState.insert(END, row.name)
			self.idListState.append(row.id)

	def searchCountry(self, event=None):
		if self.searchCountryValue.get() != "":
			self.listCountry.delete(0,END)
			self.idListCountry = []
			result = Country.select(Country.q.name.startswith(self.searchCountryValue.get().encode("utf-8")), orderBy=Country.q.name)
			for row in result:
				self.listCountry.insert(END, row.name)
				self.idListCountry.append(row.id)
		else:
			self.listCountry.delete(0,END)
			self.idListCountry = []
			result = Country.select(orderBy=Country.q.name)
			for row in result:
				self.listCountry.insert(END, row.name)
				self.idListCountry.append(row.id)

	def fieldState(self, event=None):
		result = State.select(State.q.id==self.idListState[int(self.listState.curselection()[0])])
		for row in result:
			self.selectedState = row
			self.stateValues[0].set(self.selectedState.code)
			self.stateValues[1].set(self.selectedState.name)
		result = Country.select(Country.q.id==self.selectedState.country)
		for row in result:
			self.selectedCountry = row
			self.countryValues[0].set(self.selectedCountry.code)
			self.countryValues[1].set(self.selectedCountry.name)
		self.deleteCityBt.config(state=DISABLED)
		self.saveCityBt.config(state=DISABLED)
		self.deleteZipCodeBt.config(state=DISABLED)
		self.saveZipCodeBt.config(state=DISABLED)
		self.saveCountryBt.config(state=DISABLED)
		self.deleteCountryBt.config(state=DISABLED)
		self.saveStateBt.config(state=NORMAL)
		self.deleteStateBt.config(state=NORMAL)
		self.saveCountyBt.config(state=NORMAL)
		self.deleteCountyBt.config(state=DISABLED)
		self.listCountry.delete(0,END)
		self.listZipCode.delete(0,END)
		self.listCity.delete(0,END)
		self.listCounty.delete(0,END)
		self.searchCountryValue.set("")
		self.searchZipCodeValue.set("")
		self.searchCityValue.set("")
		self.countyValues[0].set("")
		self.countyValues[1].set("")
		self.selectedCounty =  None
		self.zipCodeValues.set("")
		self.selectedZipCode =  None
		self.cityValues[0].set("")
		self.cityValues[1].set("")
		self.selectedCity =  None
		self.idListCounty = []
		self.searchCountyValue.set("")
		result = County.select(County.q.state==self.selectedState)
		for row in result:
			self.listCounty.insert(END, row.name)
			self.idListCounty.append(row.id)
	
	def searchState(self, event=None):
		if self.searchStateValue.get() != "":
			self.listState.delete(0,END)
			self.idListState = []
			result = State.select(State.q.name.startswith(self.searchStateValue.get().encode("utf-8")), orderBy=State.q.name)
			for row in result:
				self.listState.insert(END, row.name)
				self.idListState.append(row.id)
		else:
			self.listState.delete(0,END)
			self.idListState = []
			result = State.select(orderBy=State.q.name)
			for row in result:
				self.listState.insert(END, row.name)
				self.idListState.append(row.id)

	def fieldCounty(self, event=None):
		result = County.select(County.q.id==self.idListCounty[int(self.listCounty.curselection()[0])])
		for row in result:
			self.selectedCounty = row
			self.countyValues[0].set(self.selectedCounty.code)
			self.countyValues[1].set(self.selectedCounty.name)
		result = State.select(State.q.id==self.selectedCounty.state)
		for row in result:
			self.selectedState = row
			self.stateValues[0].set(self.selectedState.code)
			self.stateValues[1].set(self.selectedState.name)
		result = Country.select(Country.q.id==self.selectedState.country)
		for row in result:
			self.selectedCountry = row
			self.countryValues[0].set(self.selectedCountry.code)
			self.countryValues[1].set(self.selectedCountry.name)
		self.deleteCityBt.config(state=DISABLED)
		self.saveCityBt.config(state=DISABLED)
		self.deleteCountryBt.config(state=DISABLED)
		self.saveCountryBt.config(state=DISABLED)
		self.saveStateBt.config(state=DISABLED)
		self.deleteStateBt.config(state=DISABLED)
		self.saveCountyBt.config(state=NORMAL)
		self.deleteCountyBt.config(state=NORMAL)
		self.deleteZipCodeBt.config(state=DISABLED)
		self.saveZipCodeBt.config(state=NORMAL)
		self.listCountry.delete(0,END)
		self.listState.delete(0,END)
		self.listZipCode.delete(0,END)
		self.listCity.delete(0,END)
		self.searchStateValue.set("")
		self.searchCountryValue.set("")
		self.searchCityValue.set("")
		self.zipCodeValues.set("")
		self.selectedZipCode =  None
		self.cityValues[0].set("")
		self.cityValues[1].set("")
		self.selectedCity =  None
		self.idListZipCode = []
		self.searchZipCodeValue.set("")
		result = ZipCode.select(ZipCode.q.county==self.selectedCounty)
		for row in result:
			self.listZipCode.insert(END, row.code)
			self.idListZipCode.append(row.id)
	
	def searchCounty(self, event=None):
		if self.searchCountyValue.get() != "":
			self.listCounty.delete(0,END)
			self.idListCounty = []
			result = County.select(County.q.name.startswith(self.searchCountyValue.get().encode("utf-8")), orderBy=County.q.name)
			for row in result:
				self.listCounty.insert(END, row.name)
				self.idListCounty.append(row.id)
		else:
			self.listCounty.delete(0,END)
			self.idListCounty = []
			result = County.select(orderBy=County.q.name)
			for row in result:
				self.listCounty.insert(END, row.name)
				self.idListCounty.append(row.id)
	
	def fieldZipCode(self, event=None):
		result = ZipCode.select(ZipCode.q.id==self.idListZipCode[int(self.listZipCode.curselection()[0])])
		for row in result:
			self.selectedZipCode = row
			self.zipCodeValues.set(self.selectedZipCode.code)
		result = County.select(County.q.id==self.selectedZipCode.county)
		for row in result:
			self.selectedCounty = row
			self.countyValues[0].set(self.selectedCounty.code)
			self.countyValues[1].set(self.selectedCounty.name)
		result = State.select(State.q.id==self.selectedCounty.state)
		for row in result:
			self.selectedState = row
			self.stateValues[0].set(self.selectedState.code)
			self.stateValues[1].set(self.selectedState.name)
		result = Country.select(Country.q.id==self.selectedState.country)
		for row in result:
			self.selectedCountry = row
			self.countryValues[0].set(self.selectedCountry.code)
			self.countryValues[1].set(self.selectedCountry.name)
		self.deleteCountryBt.config(state=DISABLED)
		self.deleteStateBt.config(state=DISABLED)
		self.saveCountryBt.config(state=DISABLED)
		self.saveStateBt.config(state=DISABLED)
		self.saveCountyBt.config(state=DISABLED)
		self.deleteCountyBt.config(state=DISABLED)
		self.deleteZipCodeBt.config(state=NORMAL)
		self.saveZipCodeBt.config(state=NORMAL)
		self.deleteCityBt.config(state=DISABLED)
		self.saveCityBt.config(state=NORMAL)
		self.listCountry.delete(0,END)
		self.listState.delete(0,END)
		self.listCounty.delete(0,END)
		self.listCity.delete(0,END)
		self.searchCountyValue.set("")
		self.searchStateValue.set("")
		self.searchCountryValue.set("")
		self.cityValues[0].set("")
		self.cityValues[1].set("")
		self.selectedCity =  None
		self.idListCity = []
		self.searchCityValue.set("")
		result = City.select(City.q.zipCode==self.selectedZipCode)
		for row in result:
			self.listCity.insert(END, row.name)
			self.idListCity.append(row.id)
	
	def searchZipCode(self, event=None):
		if self.searchZipCodeValue.get() != "":
			self.listZipCode.delete(0,END)
			self.idListZipCode = []
			result = ZipCode.select(ZipCode.q.code.startswith(self.searchZipCodeValue.get().encode("utf-8")), orderBy=ZipCode.q.code)
			for row in result:
				self.listZipCode.insert(END, row.code)
				self.idListZipCode.append(row.id)
		else:
			self.listZipCode.delete(0,END)
			self.idListZipCode = []
			result = ZipCode.select(orderBy=ZipCode.q.code)
			for row in result:
				self.listZipCode.insert(END, row.code)
				self.idListZipCode.append(row.id)

	def fieldCity(self, event=None):
		result = City.select(City.q.id==self.idListCity[int(self.listCity.curselection()[0])])
		for row in result:
			self.selectedCity = row
			self.cityValues[0].set(self.selectedCity.code)
			self.cityValues[1].set(self.selectedCity.name)
		result = ZipCode.select(ZipCode.q.id==self.selectedCity.zipCode)
		for row in result:
			self.selectedZipCode = row
			self.zipCodeValues.set(self.selectedZipCode.code)
		result = County.select(County.q.id==self.selectedZipCode.county)
		for row in result:
			self.selectedCounty = row
			self.countyValues[0].set(self.selectedCounty.code)
			self.countyValues[1].set(self.selectedCounty.name)
		result = State.select(State.q.id==self.selectedCounty.state)
		for row in result:
			self.selectedState = row
			self.stateValues[0].set(self.selectedState.code)
			self.stateValues[1].set(self.selectedState.name)
		result = Country.select(Country.q.id==self.selectedState.country)
		for row in result:
			self.selectedCountry = row
			self.countryValues[0].set(self.selectedCountry.code)
			self.countryValues[1].set(self.selectedCountry.name)
		self.saveZipCodeBt.config(state=DISABLED)
		self.deleteZipCodeBt.config(state=DISABLED)
		self.saveCityBt.config(state=NORMAL)
		self.deleteCityBt.config(state=NORMAL)
		self.saveCountryBt.config(state=DISABLED)
		self.saveStateBt.config(state=DISABLED)
		self.saveCountyBt.config(state=DISABLED)
		self.deleteCountryBt.config(state=DISABLED)
		self.deleteStateBt.config(state=DISABLED)
		self.deleteCountyBt.config(state=DISABLED)
		self.listCountry.delete(0,END)
		self.listState.delete(0,END)
		self.listCounty.delete(0,END)
		self.listZipCode.delete(0,END)
		self.searchZipCodeValue.set("")
		self.searchCountyValue.set("")
		self.searchStateValue.set("")
		self.searchCountryValue.set("")
	
	def searchCity(self, event=None):
		if self.searchCityValue.get() != "":
			self.listCity.delete(0,END)
			self.idListCity = []
			result = City.select(City.q.name.startswith(self.searchCityValue.get().encode("utf-8")), orderBy=City.q.name)
			for row in result:
				self.listCity.insert(END, row.name)
				self.idListCity.append(row.id)
		else:
			self.listCity.delete(0,END)
			self.idListCity = []
			result = City.select(orderBy=City.q.name)
			for row in result:
				self.listCity.insert(END, row.name)
				self.idListCity.append(row.id)
	
	def clearAllArea(self):
		self.searchCountryValue.set("")
		self.listCountry.delete(0,END)
		self.idListCountry = []
		self.countryValues[0].set("")
		self.countryValues[1].set("")
		self.selectedCountry =  None
		self.searchStateValue.set("")
		self.listState.delete(0,END)
		self.idListState = []
		self.stateValues[0].set("")
		self.stateValues[1].set("")
		self.selectedState =  None
		self.searchCountyValue.set("")
		self.listCounty.delete(0,END)
		self.idListCounty = []
		self.countyValues[0].set("")
		self.countyValues[1].set("")
		self.selectedCounty =  None
		self.searchZipCodeValue.set("")
		self.listZipCode.delete(0,END)
		self.idListZipCode = []
		self.zipCodeValues.set("")
		self.selectedZipCode =  None
		self.searchCityValue.set("")
		self.listCity.delete(0,END)
		self.idListCity = []
		self.cityValues[0].set("")
		self.cityValues[1].set("")
		self.selectedCity =  None
		self.saveCountryBt.config(state=NORMAL)
		self.saveStateBt.config(state=DISABLED)
		self.saveCountyBt.config(state=DISABLED)
		self.saveZipCodeBt.config(state=DISABLED)
		self.saveCityBt.config(state=DISABLED)
		self.deleteCountryBt.config(state=DISABLED)
		self.deleteStateBt.config(state=DISABLED)
		self.deleteCountyBt.config(state=DISABLED)
		self.deleteZipCodeBt.config(state=DISABLED)
		self.deleteCityBt.config(state=DISABLED)
		self.searchCountry()
	
	def makeArea(self):
		leftFrame = Frame(self)
		# Section Country ----------------------------------------------------------------------------------------------------------------------------
		countryFrame = Frame(leftFrame, borderwidth=2, relief=SUNKEN)
		Label(countryFrame, text=u"Pays").pack()
		# Champs recherche et ajout d"un nouveau pays Country
		self.searchCountryValue = StringVar()
		s = Frame(countryFrame)  
		self.searchCountryEt = Entry(s,  width=33, textvariable=self.searchCountryValue, relief=GROOVE)
		self.searchCountryEt.bind("<KeyRelease>", self.searchCountry)
		self.searchCountryEt.focus()
		self.searchCountryEt.pack()
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un pays Country
		listFrame = Frame(countryFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listCountry = Listbox(listFrame)
		self.listCountry.config(yscrollcommand=scrollbar.set,width=30, selectmode=SINGLE, height=4)
		self.listCountry.bind("<ButtonRelease-1>",self.fieldCountry)
		scrollbar.config(command=self.listCountry.yview)
		self.listCountry.pack()
		listFrame.pack(side=TOP, fill=X)
		# Fields Country
		countryLabels = (u"Code", u"Nom")
		self.countryValues = [StringVar(), StringVar()]
		count = 0
		for name in countryLabels:
			f = Frame(countryFrame)
			Label(f, width=12, text=name, anchor=W).pack(side=LEFT)
			Entry(f, textvariable=self.countryValues[count]).pack(side=LEFT, fill=X)
			f.pack(side=TOP, fill=X)
			count += 1
		# Boutons enregistrement (new ou modify) et suppression
		s = Frame(countryFrame) 
		self.saveCountryBt=Button(s, image=self.imgSave, command=self.createCountry)
		self.saveCountryBt.bind("<Return>", self.createCountry)
		self.saveCountryBt.pack(side=LEFT)
		self.balloon.bind(self.saveCountryBt, u"Enregistrer")
		self.deleteCountryBt=Button(s, image=self.imgDelete, command=self.deleteCountry, state=DISABLED)
		self.deleteCountryBt.bind("<Return>", self.deleteCountry)
		self.deleteCountryBt.pack(side=LEFT)
		self.balloon.bind(self.deleteCountryBt, u"Supprimer")
		s.pack(side=TOP, fill=X)
		countryFrame.pack()
		# Section State --------------------------------------------------------------------------------------------------------------------------------------------
		stateFrame = Frame(leftFrame, borderwidth=2, relief=SUNKEN) 
		Label(stateFrame, text=u"Région").pack()
		# Champs recherche et ajout d"un nouveau State
		self.searchStateValue = StringVar()
		s = Frame(stateFrame)  
		self.searchStateEt = Entry(s,  width=33, textvariable=self.searchStateValue, relief=GROOVE)
		self.searchStateEt.bind("<KeyRelease>", self.searchState)
		self.searchStateEt.pack()
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un State
		listFrame = Frame(stateFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listState = Listbox(listFrame)
		self.listState.config(yscrollcommand=scrollbar.set,width=30, selectmode=SINGLE, height=4)
		self.listState.bind("<ButtonRelease-1>",self.fieldState)
		scrollbar.config(command=self.listState.yview)
		self.listState.pack()
		listFrame.pack(side=TOP, fill=X)
		# Fields State
		stateLabels = (u"Code", u"Nom")
		self.stateValues = [StringVar(), StringVar()]
		count = 0
		for name in stateLabels:
			f = Frame(stateFrame)
			Label(f, width=12, text=name, anchor=W).pack(side=LEFT)
			Entry(f, textvariable=self.stateValues[count]).pack(side=LEFT, fill=X)
			f.pack(side=TOP, fill=X)
			count += 1
		# Boutons enregistrement (new ou modify) et suppression
		s = Frame(stateFrame) 
		self.saveStateBt=Button(s, image=self.imgSave, command=self.createState, state=DISABLED)
		self.saveStateBt.bind("<Return>", self.createState)
		self.saveStateBt.pack(side=LEFT)
		self.balloon.bind(self.saveStateBt, u"Enregistrer")
		self.deleteStateBt=Button(s, image=self.imgDelete, command=self.deleteState, state=DISABLED)
		self.deleteStateBt.bind("<Return>", self.deleteState)
		self.deleteStateBt.pack(side=LEFT)
		self.balloon.bind(self.deleteStateBt, u"Supprimer")
		s.pack(side=TOP, fill=X)
		stateFrame.pack()		
		# Section County --------------------------------------------------------------------------------------------------------------------------------
		countyFrame = Frame(leftFrame, borderwidth=2, relief=SUNKEN) 
		Label(countyFrame, text=u"Département").pack()
		# Champs recherche et ajout d"un nouveau County
		self.searchCountyValue = StringVar()
		s = Frame(countyFrame)  
		self.searchCountyEt = Entry(s,  width=33, textvariable=self.searchCountyValue, relief=GROOVE)
		self.searchCountyEt.bind("<KeyRelease>", self.searchCounty)
		self.searchCountyEt.pack()
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un County
		listFrame = Frame(countyFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listCounty = Listbox(listFrame)
		self.listCounty.config(yscrollcommand=scrollbar.set,width=30, selectmode=SINGLE, height=4)
		self.listCounty.bind("<ButtonRelease-1>",self.fieldCounty)
		scrollbar.config(command=self.listCounty.yview)
		self.listCounty.pack()
		listFrame.pack(side=TOP, fill=X)
		# Fields County
		countyLabels = (u"Code", u"Nom")
		self.countyValues = [StringVar(), StringVar()]
		count = 0
		for name in countyLabels:
			f = Frame(countyFrame)
			Label(f, width=12, text=name, anchor=W).pack(side=LEFT)
			Entry(f, textvariable=self.countyValues[count]).pack(side=LEFT, fill=X)
			f.pack(side=TOP, fill=X)
			count += 1
		# Boutons enregistrement (new ou modify) et suppression
		s = Frame(countyFrame) 
		self.saveCountyBt=Button(s, image=self.imgSave, command=self.createCounty, state=DISABLED)
		self.saveCountyBt.bind("<Return>", self.createCounty)
		self.saveCountyBt.pack(side=LEFT)
		self.balloon.bind(self.saveCountyBt, u"Enregistrer")
		self.deleteCountyBt=Button(s, image=self.imgDelete, command=self.deleteCounty, state=DISABLED)
		self.deleteCountyBt.bind("<Return>", self.deleteCounty)
		self.deleteCountyBt.pack(side=LEFT)
		self.balloon.bind(self.deleteCountyBt, u"Supprimer")
		s.pack(side=TOP, fill=X)
		countyFrame.pack()
		leftFrame.pack(side=LEFT, fill=X)
		rightFrame = Frame(self)
		# Section ZipCode --------------------------------------------------------------------------------------------------------------------------------
		zipCodeFrame = Frame(rightFrame, borderwidth=2, relief=SUNKEN) 
		Label(zipCodeFrame, text=u"Code postal").pack()
		# Champs recherche et ajout d"un nouveau ZipCode
		self.searchZipCodeValue = StringVar()
		s = Frame(zipCodeFrame)  
		self.searchZipCodeEt = Entry(s,  width=33, textvariable=self.searchZipCodeValue, relief=GROOVE)
		self.searchZipCodeEt.bind("<KeyRelease>", self.searchZipCode)
		self.searchZipCodeEt.pack()
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un ZipCode
		listFrame = Frame(zipCodeFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listZipCode= Listbox(listFrame)
		self.listZipCode.config(yscrollcommand=scrollbar.set,width=30, selectmode=SINGLE, height=7)
		self.listZipCode.bind("<ButtonRelease-1>",self.fieldZipCode)
		scrollbar.config(command=self.listZipCode.yview)
		self.listZipCode.pack()
		listFrame.pack(side=TOP, fill=X)
		# Fields ZipCode
		self.zipCodeValues = StringVar()
		f = Frame(zipCodeFrame)
		Label(f, width=12, text=u"Code", anchor=W).pack(side=LEFT)
		Entry(f, textvariable=self.zipCodeValues).pack(side=LEFT, fill=X)
		f.pack(side=TOP, fill=X)
		# Boutons enregistrement (new ou modify) et suppression
		s = Frame(zipCodeFrame) 
		self.saveZipCodeBt=Button(s, image=self.imgSave, command=self.createZipCode, state=DISABLED)
		self.saveZipCodeBt.bind("<Return>", self.createZipCode)
		self.saveZipCodeBt.pack(side=LEFT)
		self.balloon.bind(self.saveZipCodeBt, u"Enregistrer")
		self.deleteZipCodeBt=Button(s, image=self.imgDelete, command=self.deleteZipCode, state=DISABLED)
		self.deleteZipCodeBt.bind("<Return>", self.deleteZipCode)
		self.deleteZipCodeBt.pack(side=LEFT)
		self.balloon.bind(self.deleteZipCodeBt, u"Supprimer")
		s.pack(side=TOP, fill=X)
		zipCodeFrame.pack(side=TOP)
		# Section City --------------------------------------------------------------------------------------------------------------------------------
		cityFrame = Frame(rightFrame, borderwidth=2, relief=SUNKEN) 
		Label(cityFrame, text=u"Ville").pack()
		# Champs recherche et ajout d"une nouvelle City
		self.searchCityValue = StringVar()
		s = Frame(cityFrame)  
		self.searchCityEt = Entry(s,  width=33, textvariable=self.searchCityValue, relief=GROOVE)
		self.searchCityEt.bind("<KeyRelease>", self.searchCity)
		self.searchCityEt.pack()
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"une City
		listFrame = Frame(cityFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listCity = Listbox(listFrame)
		self.listCity.config(yscrollcommand=scrollbar.set,width=30, selectmode=SINGLE, height=12)
		self.listCity.bind("<ButtonRelease-1>",self.fieldCity)
		scrollbar.config(command=self.listCity.yview)
		self.listCity.pack()
		listFrame.pack(side=TOP, fill=X)
		# Fields City
		cityLabels = (u"Code", u"Nom")
		self.cityValues = [StringVar(), StringVar()]
		count = 0
		for name in cityLabels:
			f = Frame(cityFrame)
			Label(f, width=12, text=name, anchor=W).pack(side=LEFT)
			Entry(f, textvariable=self.cityValues[count]).pack(side=LEFT, fill=X)
			f.pack(side=TOP, fill=X)
			count += 1
		# Boutons enregistrement (new ou modify) et suppression
		s = Frame(cityFrame) 
		self.saveCityBt=Button(s, image=self.imgSave, command=self.createCity, state=DISABLED)
		self.saveCityBt.bind("<Return>", self.createCity)
		self.saveCityBt.pack(side=LEFT)
		self.balloon.bind(self.saveCityBt, u"Enregistrer")
		self.deleteCityBt=Button(s, image=self.imgDelete, command=self.deleteCity, state=DISABLED)
		self.deleteCityBt.bind("<Return>", self.deleteCity)
		self.deleteCityBt.pack(side=LEFT)
		self.balloon.bind(self.deleteCityBt, u"Supprimer")
		s.pack(side=TOP, fill=X)
		cityFrame.pack(side=TOP, fill=BOTH)
		self.clearAllBt=Button(rightFrame, image=self.imgClear, command=self.clearAllArea, relief=RIDGE)
		self.clearAllBt.bind("<Return>", self.clearAllArea)
		self.clearAllBt.pack(side=BOTTOM , fill=X)
		self.balloon.bind(self.clearAllBt, u"Ré-initialiser les champs")
		rightFrame.pack(side=RIGHT, fill=BOTH)
		self.searchCountry()

	def verifyCountry(self):
		if self.countryValues[1].get() == "":
			showerror(u"Erreur de saisie", u"Le champ Nom est obligatoire !\nMerci de le compléter.")
			return False
		else:
			return True
	
	def createCountry(self, event=None):
		if self.verifyCountry():
			if  self.deleteCountryBt.config()["state"][4] == "normal":
				self.modifyCountry()
			else:
				if askyesno(u"Enregistrement", u"Souhaitez-vous enregistrer %s comme un nouveau Pays ?\n" % self.countryValues[1].get()):
					Country(code=self.countryValues[0].get().encode("utf-8"),
						name=self.countryValues[1].get().encode("utf-8"),
						createDate=datetime.datetime.now()
					)
				self.clearAllArea()
	
	def modifyCountry(self, event=None):
		if askyesno(u"Modifier", u"Souhaitez-vous modifier le Pays %s ?" % self.selectedCountry.name):
			self.selectedCountry.code=self.countryValues[0].get().encode("utf-8")
			self.selectedCountry.name=self.countryValues[1].get().encode("utf-8")
		self.clearAllArea()
	
	def deleteCountry(self, event=None):
		if askyesno(u"Suppression", u"Souhaitez-vous supprimer le Pays %s ?\nCette opération est irréversible !" % self.selectedCountry.name):
			Country.delete(self.selectedCountry.id)
		self.clearAllArea()
	
	def verifyState(self):
		if self.stateValues[1].get() == "":
			showerror(u"Erreur Région", u"Le champ Nom (de la Région) est obligatoire !\nMerci de le compléter.")
			return False
		else:
			return True
	
	def createState(self, event=None):
		if self.verifyState():
			if  self.deleteStateBt.config()["state"][4] == "normal":
				self.modifyState()
			else:
				if askyesno(u"Enregistrement", u"Souhaitez-vous enregistrer %s comme une nouvelle Région ?\n" % self.stateValues[1].get()):
					State(code=self.stateValues[0].get().encode("utf-8"),
						name=self.stateValues[1].get().encode("utf-8"),
						country=self.selectedCountry,
						createDate=datetime.datetime.now()
					)
				self.clearAllArea()
	
	def modifyState(self, event=None):
		if askyesno(u"Modifier", u"Souhaitez-vous modifier la Région %s ?" % self.selectedState.name):
			self.selectedState.code=self.stateValues[0].get().encode("utf-8")
			self.selectedState.name=self.stateValues[1].get().encode("utf-8")
		self.clearAllArea()
	
	def deleteState(self, event=None):
		if askyesno(u"Suppression", u"Souhaitez-vous supprimer la Région %s ?\nCette opération est irréversible !" % self.selectedState.name):
			State.delete(self.selectedState.id)
		self.clearAllArea()
	
	def verifyCounty(self):
		if self.countyValues[1].get() == "":
			showerror(u"Erreur Département", u"Le champ Nom (du Département) est obligatoire !\nMerci de le compléter.")
			return False
		else:
			return True
	
	def createCounty(self, event=None):
		if self.verifyCounty():
			if  self.deleteCountyBt.config()["state"][4] == "normal":
				self.modifyCounty()
			else:
				if askyesno(u"Enregistrement", u"Souhaitez-vous enregistrer %s comme un nouveau Département ?\n" % self.countyValues[1].get()):
					County(code=self.countyValues[0].get().encode("utf-8"),
						name=self.countyValues[1].get().encode("utf-8"),
						state=self.selectedState,
						createDate=datetime.datetime.now()
					)
				self.clearAllArea()
	
	def modifyCounty(self, event=None):
		if askyesno(u"Modifier", u"Souhaitez-vous modifier le Département %s ?" % self.selectedCounty.name):
			self.selectedCounty.code=self.countyValues[0].get().encode("utf-8")
			self.selectedCounty.name=self.countyValues[1].get().encode("utf-8")
		self.clearAllArea()
	
	def deleteCounty(self, event=None):
		if askyesno(u"Suppression", u"Souhaitez-vous supprimer le Département %s ?\nCette opération est irréversible !" % self.selectedCounty.name):
			County.delete(self.selectedCounty.id)
		self.clearAllArea()
	
	def verifyZipCode(self):
		if self.zipCodeValues.get() == "":
			showerror(u"Erreur Code Postal", u"Le champ Code (Postal) est obligatoire !\nMerci de le compléter.")
			return False
		else:
			return True
	
	def createZipCode(self, event=None):
		if self.verifyZipCode():
			if  self.deleteZipCodeBt.config()["state"][4] == "normal":
				self.modifyZipCode()
			else:
				if askyesno(u"Enregistrement", u"Souhaitez-vous enregistrer %s comme un nouveau Code Postal ?\n" % self.zipCodeValues.get()):
					ZipCode(code=self.zipCodeValues.get().encode("utf-8"),
						county=self.selectedCounty,
						createDate=datetime.datetime.now()
					)
			self.clearAllArea()
	
	def modifyZipCode(self, event=None):
		if askyesno(u"Modifier", u"Souhaitez-vous modifier le Code Postale %s ?" % self.selectedZipCode.code):
			self.selectedZipCode.code=self.zipCodeValues.get().encode("utf-8")
		self.clearAllArea()
	
	def deleteZipCode(self, event=None):
		if askyesno(u"Suppression", u"Souhaitez-vous supprimer le Code Postal %s ?\nCette opération est irréversible !" % self.selectedZipCode.code):
			ZipCode.delete(self.selectedZipCode.id)
		self.clearAllArea()
	
	def verifyCity(self):
		if self.cityValues[1].get() == "":
			showerror(u"Erreur Ville", u"Le champ Nom (de la Ville) est obligatoire !\nMerci de le compléter.")
			return False
		else:
			return True
	
	def createCity(self, event=None):
		if self.verifyCity():
			if  self.deleteCityBt.config()["state"][4] == "normal":
				self.modifyCity()
			else:
				if askyesno(u"Enregistrement", u"Souhaitez-vous enregistrer %s comme une nouvelle Ville ?\n" % self.cityValues[1].get()):
					City(code=self.cityValues[0].get().encode("utf-8"),
						name=self.cityValues[1].get().encode("utf-8"),
						zipCode=self.selectedZipCode,
						createDate=datetime.datetime.now()
					)
				self.clearAllArea()
	
	def modifyCity(self, event=None):
		if askyesno(u"Modifier", u"Souhaitez-vous modifier la Ville %s ?" % self.selectedCity.name):
			self.selectedCity.code=self.cityValues[0].get().encode("utf-8")
			self.selectedCity.name=self.cityValues[1].get().encode("utf-8")
		self.clearAllArea()

	def deleteCity(self, event=None):
		if askyesno(u"Suppression", u"Souhaitez-vous supprimer la Ville %s ?\nCette opération est irréversible !" % self.selectedCity.name):
			City.delete(self.selectedCity.id)
		self.clearAllArea()
	# FIN de la gestion du module Area (contient Country, State, County, ZipCode, City) -----------------------------------------
	

class CountryListGUI(Toplevel):
	def __init__(self, parent=None, balloon=None, field=None, index=None, listObject=None, path=None, log=None):
		Toplevel.__init__(self, parent)
		self.parent=parent
		self.grab_set() 
		self.transient(self.master)
		self.resizable(width=False, height=False)
		self.title(u"Pays")
		self.balloon=balloon
		self.path=path
		self.log=log
		self.imgNew=PhotoImage(file="img/add_alternative_icon.gif")
		self.field=field
		self.index=index
		self.listObject=listObject
		# Afficher un icon personnalisé
		try:
			if os.name =="posix":
				img = PhotoImage(file=self.path+"/icons/Country-icon.gif")
				self.tk.call("wm", "iconphoto", self._w, img)
			else:
				self.iconbitmap(default=self.path+"/icons/Country-icon.gif")
		except TclError:
			self.log.warning("Le window manager ne supporte pas l'icône que je veux lui mettre...")
		self.log.info("\tCountryListGUI\tStart")
		self.makeListCountry()

	def selectListCountry(self, event=None):
		if self.listListCountry.get(0)!="":
			result = Country.select(Country.q.id==self.idListListCountry[int(self.listListCountry.curselection()[0])])
			for row in result:
				self.listObject[self.index]=row
				self.field.set(row.name)
				#~ self.log.info("\tCountryListGUI\tStop")
				self.destroy()

	def searchListCountry(self, event=None):
		if self.searchListCountryValue.get() != "":
			self.listListCountry.delete(0,END)
			self.idListListCountry = []
			result = Country.select(Country.q.name.startswith(self.searchListCountryValue.get().encode("utf-8")), orderBy=Country.q.name)
			for row in result:
				self.listListCountry.insert(END, row.name)
				self.idListListCountry.append(row.id)
		else:
			self.listListCountry.delete(0,END)
			self.idListListCountry = []
			result = Country.select(orderBy=Country.q.name)
			for row in result:
				self.listListCountry.insert(END, row.name)
				self.idListListCountry.append(row.id)

	def makeListCountry(self):
		leftFrame = Frame(self)
		Label(leftFrame, text=u"Rechercher un pays").pack()
		# Champs recherche et ajout d"un nouveau Country
		self.searchListCountryValue = StringVar()
		s = Frame(leftFrame)  
		self.searchListCountryEt = Entry(s,  width=42, textvariable=self.searchListCountryValue, relief=GROOVE)
		self.searchListCountryEt.bind("<KeyRelease>", self.searchListCountry)
		self.searchListCountryEt.pack(side=LEFT,fill=X)
		newAreaBt=Button(s, image=self.imgNew, command=self.ctrlArea)
		newAreaBt.pack(side=RIGHT)
		self.balloon.bind(newAreaBt, u"Créer un nouveau pays")
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un Country
		listFrame = Frame(leftFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listListCountry = Listbox(listFrame)
		self.listListCountry.config(yscrollcommand=scrollbar.set,width=43, selectmode=SINGLE, height=16)
		self.listListCountry.bind("<ButtonRelease-1>",self.selectListCountry)
		scrollbar.config(command=self.listListCountry.yview)
		self.listListCountry.pack()
		listFrame.pack(side=TOP, fill=X)
		leftFrame.pack()
		self.searchListCountry()

	def ctrlArea(self):
		a=AreaGUI(balloon=self.balloon, log=self.log, path=self.path)


class StateListGUI(Toplevel):
	def __init__(self, parent=None, balloon=None, field=None, index=None, listObject=None, path=None, log=None):
		Toplevel.__init__(self, parent)
		self.parent=parent
		self.grab_set() 
		self.transient(self.master)
		self.resizable(width=False, height=False)
		self.title(u"Etat")
		self.balloon=balloon
		self.path=path
		self.log=log
		self.imgNew=PhotoImage(file="img/add_alternative_icon.gif")
		self.field=field
		self.index=index
		self.listObject=listObject
		# Afficher un icon personnalisé
		try:
			if os.name =="posix":
				img = PhotoImage(file=self.path+"/icons/State-icon.gif")
				self.tk.call("wm", "iconphoto", self._w, img)
			else:
				self.iconbitmap(default=self.path+"/icons/State-icon.gif")
		except TclError:
			self.log.warning("Le window manager ne supporte pas l'icône que je veux lui mettre...")
		self.log.info("\tStateListGUI\tStart")
		self.makeListState()

	def selectListState(self, event=None):
		if self.listListState.get(0)!="":
			result = State.select(State.q.id==self.idListListState[int(self.listListState.curselection()[0])])
			for row in result:
				self.listObject[self.index]=row
				self.field.set(row.name)
				#~ self.log.info("\tStateListGUI\tStop")
				self.destroy()

	def searchListState(self, event=None):
		if self.searchListStateValue.get() != "":
			self.listListState.delete(0,END)
			self.idListListState = []
			result = State.select(State.q.name.startswith(self.searchListStateValue.get().encode("utf-8")), orderBy=State.q.name)
			for row in result:
				self.listListState.insert(END, row.name)
				self.idListListState.append(row.id)
		else:
			self.listListState.delete(0,END)
			self.idListListState = []
			result = State.select(orderBy=State.q.name)
			for row in result:
				self.listListState.insert(END, row.name)
				self.idListListState.append(row.id)

	def makeListState(self):
		leftFrame = Frame(self)
		Label(leftFrame, text=u"Rechercher un etat").pack()
		# Champs recherche et ajout d"un nouveau State
		self.searchListStateValue = StringVar()
		s = Frame(leftFrame)  
		self.searchListStateEt = Entry(s,  width=42, textvariable=self.searchListStateValue, relief=GROOVE)
		self.searchListStateEt.bind("<KeyRelease>", self.searchListState)
		self.searchListStateEt.pack(side=LEFT,fill=X)
		newAreaBt=Button(s, image=self.imgNew, command=self.ctrlArea)
		newAreaBt.pack(side=RIGHT)
		self.balloon.bind(newAreaBt, u"Créer un nouvel etat")
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche d"un State
		listFrame = Frame(leftFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listListState = Listbox(listFrame)
		self.listListState.config(yscrollcommand=scrollbar.set,width=43, selectmode=SINGLE, height=16)
		self.listListState.bind("<ButtonRelease-1>",self.selectListState)
		scrollbar.config(command=self.listListState.yview)
		self.listListState.pack()
		listFrame.pack(side=TOP, fill=X)
		leftFrame.pack()
		self.searchListState()

	def ctrlArea(self):
		AreaGUI(balloon=self.balloon, log=self.log, path=self.path)



class SearchAreaGUI(Toplevel):
	def __init__(self, parent=None, balloon=None, index=None, listObject=None, 
															fieldCity=None ,fieldZipCode=None , 
															fieldCounty=None , fieldState=None , fieldCountry=None, path=None, log=None):
		Toplevel.__init__(self, parent)
		self.parent=parent
		self.grab_set() 
		self.transient(self.master)
		self.resizable(width=False, height=False)
		self.title(u"Recherche Lieu")
		self.balloon=balloon
		self.path=path
		self.log=log
		self.imgSave=PhotoImage(file="img/save_icon.gif")
		self.imgNew=PhotoImage(file="img/add_alternative_icon.gif")
		self.fieldCity=fieldCity
		self.fieldZipCode=fieldZipCode
		self.fieldCounty=fieldCounty
		self.fieldState=fieldState
		self.fieldCountry=fieldCountry
		self.index=index
		self.listObject=listObject
		# Afficher un icon personnalisé
		try:
			if os.name =="posix":
				img = PhotoImage(file=self.path+"/icons/Area-icon.gif")
				self.tk.call("wm", "iconphoto", self._w, img)
			else:
				self.iconbitmap(default=self.path+"/icons/Area-icon.gif")
		except TclError:
			self.log.warning("Le window manager ne supporte pas l'icône que je veux lui mettre...")
		self.log.info("\tSearchAreaGUI\tStart")
		self.makeSearchArea()

	def clearSearchAreaFields(self, event):
		self.searchAreaField.set("")
		self.searchAreaValue[0].set("")
		self.searchAreaValue[1].set("")
		self.searchAreaValue[2].set("")
		self.searchAreaValue[3].set("")
		self.searchAreaValue[4].set("")
		self.listArea.delete(0,END)
		self.idListArea = []

	def actionFillFields(self, event):
		if self.listArea.get(0)!="":
			if self.byArea.get()=="city":
				result = City.select(City.q.id==self.idListArea[int(self.listArea.curselection()[0])])
				for row in result:
					self.selectedCity = row
				self.searchAreaValue[0].set(self.selectedCity.name)
				self.searchAreaValue[1].set(self.selectedCity.zipCode.code)
				self.searchAreaValue[2].set(self.selectedCity.zipCode.county.name)
				self.searchAreaValue[3].set(self.selectedCity.zipCode.county.state.name)
				self.searchAreaValue[4].set(self.selectedCity.zipCode.county.state.country.name)
			elif self.byArea.get()=="zip":
				result = ZipCode.select(ZipCode.q.id==self.idListArea[int(self.listArea.curselection()[0])])
				for row in result:
					self.searchAreaValue[1].set(row.code)
				self.idListArea = []
				self.listArea.delete(0,END)
				self.byArea.set("city")
				self.searchAreaField.set("")		
				result = City.select(City.q.zipCode==row)
				for row in result:
					self.listArea.insert(END, row.name)
					self.idListArea.append(row.id)

	def actionSearchArea(self, event):
		if self.searchAreaField.get() != "":
			self.listArea.delete(0,END)
			self.idListArea = []
			if self.byArea.get()=="city":
				result = City.select(City.q.name.startswith(self.searchAreaField.get().encode("utf-8")), orderBy=City.q.name)
				for row in result:
					self.listArea.insert(END, row.name)
					self.idListArea.append(row.id)
			elif self.byArea.get()=="zip":
				result = ZipCode.select(ZipCode.q.code.startswith(self.searchAreaField.get()), orderBy=ZipCode.q.code)
				for row in result:
					self.listArea.insert(END, row.code)
					self.idListArea.append(row.id)
		else:
			self.listArea.delete(0,END)
			self.idListArea = []
			if self.byArea.get()=="city":
				result = City.select(orderBy=City.q.name)
				for row in result:
					self.listArea.insert(END, row.name)
					self.idListArea.append(row.id)
			elif self.byArea.get()=="zip":
				result = ZipCode.select(orderBy=ZipCode.q.code)
				for row in result:
					self.listArea.insert(END, row.code)
					self.idListArea.append(row.id)

	def actionSelectArea(self,event=None):
		self.fieldCity.set(self.searchAreaValue[0].get())
		self.fieldZipCode.set(self.searchAreaValue[1].get())
		self.fieldCounty.set(self.searchAreaValue[2].get())
		self.fieldState.set(self.searchAreaValue[3].get())
		self.fieldCountry.set(self.searchAreaValue[4].get())
		self.listObject[self.index]=self.selectedCity
		self.destroy()

	def makeSearchArea(self):
		leftFrame = Frame(self)
		Label(leftFrame, text=u"Rechercher un lieu").pack()
		# Récupération des infos Area (pays, ville, code postale)
		s = Frame(leftFrame)        
		self.byArea = StringVar()
		byCitySA = Radiobutton(s, text=u"par ville", variable=self.byArea, value="city")
		byCitySA.bind("<ButtonRelease-1>",self.clearSearchAreaFields)
		byCitySA.pack(side=LEFT)
		byZipSA = Radiobutton(s, text=u"par CP", variable=self.byArea, value="zip")
		byZipSA.bind("<ButtonRelease-1>",self.clearSearchAreaFields)
		byZipSA.pack(side=LEFT)
		s.pack(side=TOP)
		self.byArea.set("city")
		# Champs recherche et ajout d"une nouvelle Area
		self.searchAreaField = StringVar()
		s = Frame(leftFrame)  
		searchAreaEt = Entry(s,  width=37, textvariable=self.searchAreaField, relief=GROOVE)
		searchAreaEt.bind("<KeyRelease>", self.actionSearchArea)
		searchAreaEt.focus()
		searchAreaEt.pack(side=LEFT)
		self.balloon.bind(searchAreaEt, u"Saisir les premières lettres d'un Lieu\nou les premiers chiffres d'un Code Postal.")
		newAreaBT=Button(s, image=self.imgNew, command=self.ctrlArea)
		newAreaBT.pack(side=RIGHT)
		self.balloon.bind(newAreaBT, u"Créer un nouveau Lieu")
		s.pack(side=TOP, fill=X)
		# Affichage du resultat de la recherche de Area
		listFrame = Frame(leftFrame) 
		scrollbar = Scrollbar(listFrame)
		scrollbar.pack(side=RIGHT, fill=Y)
		self.listArea = Listbox(listFrame)
		self.listArea.config(yscrollcommand=scrollbar.set,width=38, selectmode=SINGLE, height=16)
		self.listArea.bind("<ButtonRelease-1>",self.actionFillFields)
		scrollbar.config(command=self.listArea.yview)
		self.listArea.pack()
		self.balloon.bind(self.listArea, u"Séléctionner un Lieu")
		listFrame.pack(side=TOP, fill=X)
		# Fin de recherche Area
		# Création des champs a renseigner 
		searchAreaLabels = (u"Ville", u"Code postal", u"Département", u"Région", u"Pays")
		self.searchAreaValue = [StringVar(), StringVar(), StringVar(), StringVar(), StringVar()]
		count = 0
		for name in searchAreaLabels:
			f = Frame(leftFrame)
			Label(f, width=12, text=name, anchor=W).pack(side=LEFT)
			Entry(f, textvariable=self.searchAreaValue[count], state=DISABLED, bd=0, disabledforeground="black").pack(side=LEFT, fill=X)
			f.pack(side=TOP, fill=X)
			count += 1
		# Boutons enregistrement (new ou modify) et suppression
		saveBt=Button(leftFrame, image=self.imgSave, command=self.actionSelectArea)
		saveBt.bind("<Return>", self.actionSelectArea)
		saveBt.pack(side=BOTTOM, fill=X)
		self.balloon.bind(saveBt, u"Valider le choix")
		leftFrame.pack()

	def ctrlArea(self):
		AreaGUI(balloon=self.balloon, log=self.log, path=self.path)